const SET_USER_INFO = 'SET_USER_INFO'
const SET_LOGGED_IN = 'SET_LOGGED_IN'

const state = {
	userInfo: null,
	loggedIn: false,
}

const getters = {
	user: (state) => {
		return state.userInfo ? state.userInfo.user : null
	},
	userInfo: (state) => state.userInfo,
	loggedIn: (state) => state.loggedIn,
}

const mutations = {
	[SET_USER_INFO](state, userInfo) {
		state.userInfo = userInfo
	},
	[SET_LOGGED_IN](state, loggedIn) {
		state.loggedIn = loggedIn
	},
}

const actions = {}

export default {
	state,
	getters,
	mutations,
	actions,
}
